Using threads in QT can improve productivity.To use a thread, go through four steps:(1) First create a C + + class file, remember to inherit the thread, create the following steps:A, the first stepB, Step two(2) Customizing a run function, the program jumps to the run function when the thread is started latervoid run ();(3) Initialize threadNew Hdthread ();(4) Start threadMythread->start ();Here's a look at the specific examples of threading usage:Thread header file Hdthread.h:1 #ifndef Hdthread
message structure Reference is as follows:Struct msgbuf {Long mtype;Char mtext [1];};
The mtext field is an array (or other structure) whose size is specified by msgsz, a nonnegative integer value. Messages of zero length (I. e., no mtext field) are permitted.
That is, the mtex area can be an array or struct, And the size is specified by the msgsz parameter.
Function: receives messages from a message queue.Prototype ssize_t msgrcv (INT msqid, void
In ngui, uiwidget is the base class of all components. It stores the display content, colors, depth, position, size, angle, and Polygon Shape, which uipanel belongs. This is what the uiwidget undertakes. All subclasses of uiwidget have the same attributes and tasks as above. The relationship between uiwidget and uipanel is very close, because uipanel undertakes all the rendering work of uiwidget, while uiwidget only undertakes the data to be rendered for storage. Therefore, when the uiwidget cha
= Measurespec.getmode (Measurespec); int specsize = measurespec.getsize (Measurespec); mascent = (int) mtextpaint.ascent (); if (Specmode = = measurespec.exactly) {//We were told how big to be result = specsize; } else {//Measure the text (beware:ascent is a negative number) result = (int) (-mascent + MTEXTP Aint.descent ()) + getpaddingtop () + Getpaddingbottom (); if (Specmode = = Measurespec.at_most) {//Respect At_most value if that's what's cal
, the corresponding structure of the message queue is initialized as follows: Msg_perm.cuid and Msg_perm.uid are set to the user ID of the current process,Msg_perm.cuid and Msg_perm.uid are set to the current process group Id;msg_perm.mode are set to Msgflg;msg_qnum, Msg_lspid, Msg_lrpid, Msg_stime and The msg_rtime is set to 0;msg_ctime is set to the current time; Msg_qbytes is set to the system limit value MSGMNB.
The msgsnd () function adds a message to the message queue.
.
The message structure reference form is as follows:
struct MSGBUF {
Long Mtype;
char mtext [1];
};
The Mtext field is a array (or other structure) whose the size was specified by Msgsz, a nonnegative integer value. Messages of zero length (i.e., no mtext field) are permitted.
That is, the Mtex area can be a number or structure, and the size is indicated by the parameter msgsz.
Function: To receive messages from a message queue
Prototype ssi
(0, 0, getmeasuredwidth (), Getmeasuredheight (), mtextpaint);
Generate random text color Mtextpaint.setargb (255, Mrandom.nextint +, Mrandom.nextint (+) +, Mrandom.nextint (200) + 20); Draw the text in the middle of the layout canvas.drawtext (Mtitletext, getwidth ()/2-mbound.width ()/2, GetHeight ()/2 + mbound.height ()/2, Mtex
Tpaint); Interference effect 1--interference point for (PointF pointf:mpoints) {Mpointpaint.setargb (255, Mrandom.nexti
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.